package personal.model.dao;

import java.sql.SQLException;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import personal.model.vo.AdminVO;
import personal.model.vo.DeptVO;
import personal.model.vo.GradeVO;

public class CodeManagementDaoImpl extends SqlMapClientDaoSupport
		implements CodeManagementDao{
	@Override
	public void insertDeptCode(DeptVO deptVO) throws SQLException {
		this.getSqlMapClient().insert("code.insertDeptCode", deptVO);
	}
	@Override
	public void insertAdminCode(AdminVO adminVO) throws SQLException {
		this.getSqlMapClient().insert("code.insertAdminCode", adminVO);
	}
	@Override
	public void insertGradeCode(GradeVO gradeVO) throws SQLException {
		this.getSqlMapClient().insert("code.insertGradeCode", gradeVO);
	}
	@Override
	public List<DeptVO> selectDeptCode() throws SQLException {
		return this.getSqlMapClient().queryForList("code.selectDeptCode");
	}
	@Override
	public List<AdminVO> selectAdminCode() throws SQLException {
		return this.getSqlMapClient().queryForList("code.selectAdminCode");
	}
	@Override
	public List<GradeVO> selectGradeCode() throws SQLException {
		return this.getSqlMapClient().queryForList("code.selectGradeCode");
	}
	@Override
	public void updateDeptCode(DeptVO deptVO) throws SQLException {
		this.getSqlMapClient().update("code.updateDeptCode", deptVO);
	}
	@Override
	public void updateAdminCode(AdminVO adminVO) throws SQLException {
		this.getSqlMapClient().update("code.updateAdminCode", adminVO);
	}
	@Override
	public void updateGradeCode(GradeVO gradeVO) throws SQLException {
		this.getSqlMapClient().update("code.updateGradeCode", gradeVO);
	}
	@Override
	public void deleteDeptCode(int deptNo) throws SQLException {
		this.getSqlMapClient().delete("code.deleteDeptCode", deptNo);
	}
	@Override
	public void deleteAdminCode(int adminNo) throws SQLException {
		this.getSqlMapClient().delete("code.deleteAdminCode", adminNo);
	}
	@Override
	public void deleteGradeCode(int gradeNo) throws SQLException {
		this.getSqlMapClient().delete("code.deleteGradeCode", gradeNo);
	}
	@Override
	public DeptVO selectDeptCodeByDeptNo(int deptNo) throws SQLException {
		return (DeptVO)this.getSqlMapClient().queryForObject("code.selectDeptCodeByDeptNo", deptNo);
	}
	@Override
	public AdminVO selectAdminCodeByAdminNo(int adminNo) throws SQLException {
		return (AdminVO)this.getSqlMapClient().queryForObject("code.selectAdminCodeByAdminNo", adminNo);
	}
	@Override
	public GradeVO selectGradeCodeByGradeNo(int gradeNo) throws SQLException {
		return (GradeVO)this.getSqlMapClient().queryForObject("code.selectGradeCodeByGradeNo", gradeNo);
	}
}